import { createApp } from 'vue'
import pinia from '@/store'
import './style.css'
import App from './App.vue'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import DataVVue3 from '@kjgl77/datav-vue3'
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'
import mock from './mock/index'

import router from '@/router/index'
// 引入 echarts
import * as echarts from 'echarts'
import themeJSON from '@/assets/weizwz.json'
echarts.registerTheme('weizwz', themeJSON)

const app = createApp(App)
// 全局挂载 echarts
app.config.globalProperties.$echarts = echarts

app.use(ElementPlus)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
  app.component(`ElIcon${key}`, component)
}
console.log(process.env.NODE_ENV)
if (process.env.NODE_ENV === 'production') {
  createProdMockServer(mock)
  console.log(process.env.NODE_ENV)
}

app.use(router).use(pinia).use(DataVVue3).mount('#app')
